home *** CD-ROM | disk | FTP | other *** search
- head 1.10;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.10
- date 90.09.24.14.40.30; author douglis; state Exp;
- branches ;
- next 1.9;
-
- 1.9
- date 90.05.01.16.50.36; author douglis; state Exp;
- branches ;
- next 1.8;
-
- 1.8
- date 89.11.07.18.19.42; author brent; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 89.10.24.10.15.16; author brent; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 89.10.11.07.51.32; author brent; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 89.09.11.11.46.15; author douglis; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 89.09.11.10.39.11; author brent; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 89.06.23.16.48.24; author brent; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 89.06.23.16.17.26; author brent; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 89.06.23.15.50.54; author brent; state Exp;
- branches ;
- next ;
-
-
- desc
- @Main program for rawstat
- @
-
-
- 1.10
- log
- @changes for migration stats
- @
- text
- @/*
- * rawstat.c --
- *
- * Print out kerel statitics in a raw format;
- * <Structure name>
- * <field> <value>
- * <field> <value>
- * <field> <value>
- *
- * Copyright (C) 1986 Regents of the University of California
- * All rights reserved.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: /sprite/src/cmds/rawstat/RCS/rawstat.c,v 1.9 90/05/01 16:50:36 douglis Exp Locker: douglis $ SPRITE (Berkeley)";
- #endif not lint
-
- #include "sprite.h"
- #include "fs.h"
- #include "fsCmd.h"
- #include "stdio.h"
- #include "option.h"
- #include "vm.h"
- #include "sysStats.h"
- #include "kernel/vm.h"
- #include "kernel/fs.h"
- #include "kernel/fsStat.h"
- #include "kernel/sched.h"
- #include "kernel/procMigrate.h"
-
- Boolean doAllFsStats = FALSE;
- Boolean doAllVmStats = FALSE;
- Boolean doAllRpcStats = FALSE;
- Boolean doAllProcStats = FALSE;
- Boolean doAllRecovStats = FALSE;
- Boolean doAllMigStats = FALSE;
- Boolean noIdle = FALSE;
- Boolean zero = FALSE;
- Boolean all = FALSE;
-
- Option optionArray[] = {
- {OPT_TRUE, "fs", (Address)&doAllFsStats, "Print ALL file system stats"},
- {OPT_TRUE, "vm", (Address)&doAllVmStats, "Print ALL vm stats"},
- {OPT_TRUE, "rpc", (Address)&doAllRpcStats, "Print ALL rpc stats"},
- {OPT_TRUE, "proc", (Address)&doAllProcStats, "Print ALL proc stats"},
- {OPT_TRUE, "recov", (Address)&doAllRecovStats, "Print ALL recov stats"},
- {OPT_TRUE, "mig", (Address)&doAllMigStats, "Print ALL mig stats"},
- {OPT_TRUE, "noidle", (Address)&noIdle, "Don't print idle ticks info"},
- {OPT_TRUE, "zero", (Address)&zero, "Print zero valued stats"},
- {OPT_TRUE, "all", (Address)&all, "Print all stats"},
- };
- int numOptions = sizeof(optionArray) / sizeof(Option);
-
- Fs_Stats fsStats;
- Vm_Stat vmStats;
- Fs_TypeStats fsTypeStats;
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- int status = SUCCESS;
- int virtualHost, physicalHost;
-
- argc = Opt_Parse(argc, argv, optionArray, numOptions);
-
- if (all) {
- doAllFsStats = TRUE;
- doAllVmStats = TRUE;
- doAllRpcStats = TRUE;
- doAllProcStats = TRUE;
- doAllRecovStats = TRUE;
- doAllMigStats = TRUE;
- }
-
- system("echo RAWSTAT `hostname` `date`");
-
- if (!noIdle) {
- PrintRawIdle();
- }
-
- if (doAllFsStats) {
- status = Fs_Command(FS_RETURN_STATS, sizeof(Fs_Stats), &fsStats);
- if (status != SUCCESS) {
- Stat_PrintMsg(status, "Fs_Command(FS_RETURN_STATS)");
- } else if (fsStats.statsVersion == FS_STAT_VERSION) {
- PrintRawFsCltName(&fsStats.cltName);
- PrintRawFsSrvName(&fsStats.srvName);
- PrintRawFsGen(&fsStats.gen);
- PrintRawFsBlockCache(&fsStats.blockCache);
- PrintRawFsAlloc(&fsStats.alloc);
- PrintRawFsNameCache(&fsStats.nameCache);
- PrintRawFsHandle(&fsStats.handle);
- PrintRawFsPrefix(&fsStats.prefix);
- PrintRawFsLookup(&fsStats.lookup);
- PrintRawFsObject(&fsStats.object);
- PrintRawFsRecovery(&fsStats.recovery);
- PrintRawFsConsist(&fsStats.consist);
- PrintRawFsWriteBack(&fsStats.writeBack);
- PrintRawRemoteIO(&fsStats.rmtIO);
- PrintRawFsMig(&fsStats.mig);
- } else {
- fprintf(stderr,
- "Wrong version of Fs_Stats: kernel is %d, while ours is %d.\n",
- fsStats.statsVersion, FS_STAT_VERSION);
- }
- }
- if (doAllVmStats) {
- int pageSize;
- status = Vm_Cmd(VM_GET_STATS, &vmStats);
- if (status != SUCCESS) {
- Stat_PrintMsg(status, "Vm_Cmd failed");
- exit(status);
- }
- Vm_PageSize(&pageSize);
- PrintRawVmStat(&vmStats);
- printf("\tpagesize %d\n", pageSize);
- }
- if (doAllRpcStats) {
- PrintRawRpcCltStat();
- PrintRawRpcSrvStat();
- PrintSrvCount();
- PrintCallCount();
- }
- if (doAllProcStats) {
- PrintRawProcMigStat();
- }
- if (doAllMigStats) {
- PrintRawMigStat();
- }
- if (doAllRecovStats) {
- PrintRawRecovStat();
- }
- exit(0);
- }
-
-
- /*
- *----------------------------------------------------------------------
- *
- * PrintRawIdle --
- *
- * Prints the raw idle ticks of the machine.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
- PrintRawIdle()
- {
- Sched_Instrument schedStats;
- struct perProcessor *X = &schedStats.processor[0];
- ReturnStatus status;
-
- status = Sys_Stats(SYS_SCHED_STATS, 0, &schedStats);
- if (status != SUCCESS) {
- Stat_PrintMsg(status, "Error in Sys_Stats");
- exit(status);
- }
- printf("numContextSwitches %8u\n", X->numContextSwitches);
- printf("numInvoluntarySwitches %8u\n", X->numInvoluntarySwitches);
- printf("numFullCS %8u\n", X->numFullCS);
- printf("idleTime %8d.%06d\n", X->idleTime.seconds,
- X->idleTime.microseconds);
- printf("idleTicksLow %8u\n", X->idleTicksLow);
- printf("idleTicksOverflow %8u\n", X->idleTicksOverflow);
- printf("idleTicksPerSecond %8u\n", X->idleTicksPerSecond);
- printf("noInput %8d.%06d\n", schedStats.noUserInput.seconds,
- schedStats.noUserInput.microseconds);
- printf("\n");
-
- }
-
- /*
- *----------------------------------------------------------------------
- *
- * ZeroPrint --
- *
- * Prints a field if non-zero or if the global variable zero is set.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
- ZeroPrint(format, value)
- char *format;
- int value;
- {
- if (zero || value != 0) {
- printf(format, value);
- }
- }
-
- @
-
-
- 1.9
- log
- @added mig calls
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /sprite/src/cmds/rawstat/RCS/rawstat.c,v 1.8 89/11/07 18:19:42 brent Exp Locker: douglis $ SPRITE (Berkeley)";
- d86 20
- a105 1
- exit(status);
- a106 14
- PrintRawFsCltName(&fsStats.cltName);
- PrintRawFsSrvName(&fsStats.srvName);
- PrintRawFsGen(&fsStats.gen);
- PrintRawFsBlockCache(&fsStats.blockCache);
- PrintRawFsAlloc(&fsStats.alloc);
- PrintRawFsNameCache(&fsStats.nameCache);
- PrintRawFsHandle(&fsStats.handle);
- PrintRawFsPrefix(&fsStats.prefix);
- PrintRawFsLookup(&fsStats.lookup);
- PrintRawFsObject(&fsStats.object);
- PrintRawFsRecovery(&fsStats.recovery);
- PrintRawFsConsist(&fsStats.consist);
- PrintRawFsWriteBack(&fsStats.writeBack);
- PrintRawRemoteIO(&fsStats.rmtIO);
- d173 2
- @
-
-
- 1.8
- log
- @Added fs_Stats.rmtIO
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /sprite/src/cmds/rawstat/RCS/rawstat.c,v 1.7 89/10/24 10:15:16 brent Exp Locker: brent $ SPRITE (Berkeley)";
- d36 1
- d47 1
- d73 1
- d123 3
- d129 1
- @
-
-
- 1.7
- log
- @Added more FS stats
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawstat.c,v 1.6 89/10/11 07:51:32 brent Exp Locker: brent $ SPRITE (Berkeley)";
- d98 1
- @
-
-
- 1.6
- log
- @Added -recov stats
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawstat.c,v 1.5 89/09/11 11:46:15 douglis Exp Locker: brent $ SPRITE (Berkeley)";
- d96 2
- @
-
-
- 1.5
- log
- @changes for process migration statistics
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawstat.c,v 1.4 89/09/11 10:39:11 brent Exp Locker: douglis $ SPRITE (Berkeley)";
- d35 1
- d45 1
- d70 1
- d116 3
- @
-
-
- 1.4
- log
- @Updated to new typedefs
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawstat.c,v 1.3 89/06/23 16:48:24 brent Exp $ SPRITE (Berkeley)";
- d29 1
- d34 1
- d43 1
- d67 1
- d110 3
- @
-
-
- 1.3
- log
- @Chagned to unsigned print format to handle large numbers
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawstat.c,v 1.2 89/06/23 16:17:26 brent Exp $ SPRITE (Berkeley)";
- d47 1
- a47 1
- FsStats fsStats;
- d49 1
- a49 1
- FsTypeStats fsTypeStats;
- d73 1
- a73 1
- status = Fs_Command(FS_RETURN_STATS, sizeof(FsStats), &fsStats);
- @
-
-
- 1.2
- log
- @Added -all option
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawstat.c,v 1.1 89/06/23 15:50:54 brent Exp Locker: brent $ SPRITE (Berkeley)";
- d137 3
- a139 3
- printf("numContextSwitches %8d\n", X->numContextSwitches);
- printf("numInvoluntarySwitches %8d\n", X->numInvoluntarySwitches);
- printf("numFullCS %8d\n", X->numFullCS);
- d142 3
- a144 3
- printf("idleTicksLow %8d\n", X->idleTicksLow);
- printf("idleTicksOverflow %8d\n", X->idleTicksOverflow);
- printf("idleTicksPerSecond %8d\n", X->idleTicksPerSecond);
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d15 1
- a15 1
- static char rcsid[] = "$Header: /a/newcmds/fsstat/RCS/fsstat.c,v 1.5 89/06/15 17:46:03 brent Exp $ SPRITE (Berkeley)";
- d35 1
- d43 1
- d56 1
- d59 6
- @
-